package com.dpstudio.ymprestlful.service.impl;

import com.dpstudio.ymprestlful.service.Notify;
import com.intellij.notification.*;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

/**
 * @Author: mengxiang.
 * @Date: 2020/6/22.
 * @Time: 11:37 上午.
 * @Description:
 */
public class NotificationImpl implements Notify {


    private final Project project;

    private String GROUP_DISPLAY_ID = "YMPRestful Notification";

    public NotificationImpl(@NotNull Project project) {

        this.project = project;
    }

    @Override
    public Notification info(@NotNull String content) {
        return notify(content, NotificationType.INFORMATION);
    }

    @Override
    public Notification warning(@NotNull String content) {
        return notify(content, NotificationType.WARNING);
    }

    @Override
    public Notification error(@NotNull String content) {
        return notify(content, NotificationType.ERROR);
    }

    @Override
    public Notification notify(@NotNull String content, @NotNull NotificationType type) {
        Notification notification = new Notification(GROUP_DISPLAY_ID,"提示",content,type);
        notification.notify(project);
        return notification;
    }
}
